﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Treinamento2015_01.Controllers
{
    public class HomeController : BaseController
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public ActionResult SetCulture(string culture)
        {
            CultureInfo c = new CultureInfo(culture);

            System.Threading.Thread.CurrentThread.CurrentCulture = c; //datetime, ...
            System.Threading.Thread.CurrentThread.CurrentUICulture = c; //resources, ...
            Console.WriteLine(Request.Url.PathAndQuery);
            Response.SetCookie(new HttpCookie("languageCulture", culture));

            return Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString());
        }        
    }
}